package com.gwm.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gwm.order.entity.TbOrderDetail;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 订单详情表 Mapper 接口
 * </p>
 *
 * @author heima
 * @since 2020-12-01
 */
public interface TbOrderDetailMapper extends BaseMapper<TbOrderDetail> {

    @Select("select od.sku_id, sum(od.num) num from tb_order o ,tb_order_detail od where  " +
            " od.order_id=o.order_id and   o.status=1 and    TIMESTAMPDIFF(MINUTE, o.create_time,NOW()) >60 " +
            " GROUP BY od.sku_id")
    List<TbOrderDetail> findOverTimeOrderDetail();
}
